package pri.syl.xiaowu.websocket.autoconfigure;

import pri.syl.xiaowu.websocket.init.WebsocketInit;
import pri.syl.xiaowu.websocket.init.WebsocketRouteInit;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author YunLong
 * @Date 2021/7/18 17:39
 * @Description webSocket配置类
 **/
@Configuration
@EnableConfigurationProperties(WebsocketProperties.class)
public class WebsocketAutoConfiguration {
//    @NacosInjected
//    private NamingService namingService;
    /*
     * 路由容器初始化
     * @apiNote [附加描述]
     * @return com.ruiruan.websocket.init.WebsocketRouteInit
     * @author YunLong
     * @date 2021/7/19 9:11
     */
    @Bean
    @ConditionalOnMissingBean(WebsocketRouteInit.class)
    public WebsocketRouteInit websocketRouteInit() {
        return new WebsocketRouteInit();
    }

    /*
     * Websocket初始化
     * @apiNote [附加描述]
     * @return com.ruiruan.websocket.init.WebsocketInit
     * @author YunLong
     * @date 2021/7/19 9:11
     */
    @Bean
    @ConditionalOnMissingBean(WebsocketInit.class)
    public WebsocketInit websocketInit() {
        return new WebsocketInit();
    }
}
